package org.demo2.springmvc_demo3.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.demo2.springmvc_demo3.entity.User;

@Mapper
public interface UserMapper {
    @Insert("insert into user(username, password, email, sex, role) values(#{username}, #{password}, #{email}, #{sex}, #{role})")
    int addUser(User user);

    @Select("select * from user where username = #{username} and password = #{password}")
    User findUserByUsernameAndPassword(@Param("username") String username, @Param("password") String password);
}
